<!DOCTYPE html>
<html  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>查看工资详情</title>
    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="table-responsive">
    <table class="table table-striped ">
        <thead>
        <tr>
            <th>月份</th>
            <th>姓名</th>
            <th>部门</th>
            <th>学历</th>
            <th>基本工资</th>
            <th>奖金</th>
            <th>扣除工资</th>
            <th>实发工资</th>
            <th>备注</th>
        </tr>
        </thead>
        <tbody id="staffList">
        <tr th:each="ownSalary : ${ownSalarys}">
            <td th:text="${ownSalary.month}">1月</td>
            <td th:text="${ownSalary.name}">张三</td>
            <td th:text="${ownSalary.department}">研发部</td>
            <td th:text="${ownSalary.education}">研究生</td>
            <td th:text="${ownSalary.basicSalary}">5000</td>
            <td th:text="${ownSalary.bonus}">2000</td>
            <td th:text="${ownSalary.deduct}">200</td>
            <td th:text="${ownSalary.actualSalary}">6800</td>
            <td th:text="${ownSalary.remarks}">迟到1次</td>
            <td>
                <div class="btn-group">
                    <a href="javascript:void(0)" class="btn btn-info"   th:onclick="loadPageParam2('updateSalary','[(${ownSalary.sid})]','[(${ownSalary.month})]')" >修改</a><a href=""  th:onclick="deleteBySidMon('[(${ownSalary.sid})]','[(${ownSalary.month})]')"   class="btn btn-danger">删除</a>
                </div>
            </td>
        </tr>

        </tbody>
    </table>
</div>
</body>
<script>
    function deleteBySidMon(sid , month){
        $.ajax({
            url: "/personSalary/deleteBySidMon",
            data: {"sid": sid,"month":month},
            type: "POST",
            dataType: "JSON",
            success: function () {
                alert("删除成功！")
            },
            error:function (){
                alert("删除失败！")
            }
        })
    }

    function loadPageParam2(url,sid,month) {
        // alert(url+","+sid+","+month)
        $.get(url,{sid:sid,month:month},function(data,status){
            $("#right").html(data);
        });
    }
</script>
</html>